<link href="{CSS_PATH}video_store.css" rel="stylesheet" type="text/css" />
<!--[if lt IE 9]><link href="{CSS_PATH}ielt9.css" rel="stylesheet" type="text/css" /><![endif]-->
<script type="text/javascript" src="{JS_PATH}/jquery.min.js"></script>
<script type="text/javascript" src="{JS_PATH}video/swfobject.js"></script>
<script type="text/javascript" src="{JS_PATH}video/swfobject2.js"></script>
<input type="hidden" name="video_url" id="video_url" value="">
<div class="m_box">
	<div class="clr h_box">
		<ul class="clr">
			<li><a href="#" title="#ct1" class="ac">从56视频库选择</a></li>
		</ul>
	</div>
    <div class="clr ct" id="ct1">
    	<div class="l">
        	<div class="r1">
           	  <form action="" method="get">
                	<label style="font-size: 12px;" title="本站上传视频">原创<input type="checkbox" id="userupload" name="userupload" title="本站上传视频"></label> <input name="subject" id="subject_s" type="text" class="s_ipt"/><input type="button" id="search" value="搜索" class="s_btn" onclick="get_videoes(1);"/>
                </form>
          </div>
        	<div class="r2">
            	<ul class="clr col3" id="ulic">
				{if !empty($infos)}
				{loop $infos $info}
                    <li><div class="w9"><a href="javascript:void(0);" title="{$info['subject']}" data-player="{$info['player']}" onclick="a_click(this);"><span></span><img src="{$info['cover']}" width="90" height="51" /></a><p>{str_cut($info['subject'], 18)}</p></div></li>
				{/loop}
				{else}
					&nbsp;&nbsp;&nbsp;&nbsp;56视频库中没有您的视频，请先上传视频！
				{/if}
                </ul>
            </div>
        	<div class="r3">
            	<div class="ipages">
                	{$pages}
                </div>
            </div>
        </div>
    	<div class="r" id="video_view"><img src="{IMG_PATH}spyl.jpg" width="300" height="225" /></div>
    </div>
</div>
<script type="text/javascript">
	
function get_videoes(page) {
			var subject = $('#subject_s').val();
			var userupload = 0;
			if ($('#userupload').attr('checked')=='checked') {
				userupload = 1;
			}
			$.get('index.php', {m:'video56', c:'video_for_ck', a:'search', subject:subject, page:page, userupload:userupload}, function(data){
				var obj = eval('(' + data + ')');
				$('.ipages').html(obj.pages);
				$('#ulic').html(obj.html);
			});
		}
	
var CKEDITOR = window.parent.CKEDITOR;

var okListener = function(event){
	var video_url = document.getElementById("video_url").value;
	if (video_url=='') {
	} else {
		video_url = "<embed src='"+video_url+"' type='application/x-shockwave-flash' allowFullScreen='true' width='414' height='305' allowNetworking='all' wmode='opaque' allowScriptAccess='always'></embed>";
		this._.editor.insertHtml(video_url);
		CKEDITOR.dialog.getCurrent().removeListener("ok", okListener);
	}
};
CKEDITOR.dialog.getCurrent().on("ok", okListener);

$.ajaxSetup({ 
    async : false 
}); 
function a_click(obj) {
	var player = $(obj).attr('data-player');
	$("#ulic div.w9 a").removeClass("ac");
	$(obj).addClass("ac");
	$('#video_url').val(player);
	var html = "<embed src='"+player+"' type='application/x-shockwave-flash' allowFullScreen='true' width='300' height='225' allowNetworking='all' wmode='opaque' allowScriptAccess='always'></embed>";
	$('#video_view').html(html);
}

</script>
